#!/bin/bash
#===================================================================================
# OPENBOX EXIT MENU
# FILE: obexit
#
# DESCRIPTION: Show a exit menu based on rofi launcher. Use UTF8 symbols as icons.
#
# AUTHOR: Leonardo Marco
# VERSION: 1.0
# CREATED: 05.04.2020 
# LICENSE: GNU General Public License v3.0
#===================================================================================

options=" ⏻\tPower off
 🗘\tReboot
 ⏸\tSuspend
 ⏾\tHibernate
 🗙\tLogout
 🗝 \tLock session"

if [ $# -eq 0 ]; then
    echo -e "$options"

elif [ "$1" = "show" ]; then
    rofi -theme openbox-menu -show Action -modi "Action:$(readlink -f "$0")" -lines 6

else
    case "$@" in
    *"Logout")
        openbox --exit
        ;;
    *"Lock session")
        x-locker
        ;;
    *"Power off")
        systemctl poweroff
        ;;
    *"Reboot")
        systemctl reboot
        ;;
    *"Suspend")
        systemctl suspend
        ;;
    *"Hibernate")
        systemctl hibernate
        ;;
    esac
fi
